package behavioral.iterator;

public class BookShelf implements Aggregate {
	private Book[] _books;
	private int _last = 0;
	public BookShelf(int maxsize) {
		this._books = new Book[maxsize];
	}
	public Book getBookAt(int index) {
		return _books[index];
	}
	public void appendBook(Book book) {
		this._books[_last++] = book;
	}
	public int getLength() {
		return _last;
	}
	public Iterator createIterator() {
		return new BookShelfIterator(this);
	}

}
